package com.kk.netty.nio.network.selector;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

public class BoundDaryClient {
    public static void main(String[] args) throws IOException {
        SocketChannel sc =  SocketChannel.open ();
        sc.connect (new InetSocketAddress ("localhost", 8080));
        SocketAddress address = sc.getLocalAddress ( );
        sc.write (Charset.defaultCharset ().encode ("0123456789abcdef"));
        sc.write (Charset.defaultCharset ().encode ("012345Q\n6789abcdef3333\n"));
    }

    public void unprocessedBoundary()  throws IOException{
        Socket socket = null;
        try {
            socket = new Socket ("localhost", 9000);
            OutputStream out = socket.getOutputStream ( );
            out.write ("hello".getBytes ( ));
            out.write ("world".getBytes ( ));
            out.write ("你好".getBytes ( ));
            out.close ( );
        } catch (IOException e) {
            e.printStackTrace ( );
        }
    }
}
